home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
editors
/
tscredd2
/
scrdisk5.exe
/
arc
/
SCRDEMO.C
< prev
next >
Wrap
Text File
|
1990-05-11
|
31KB
|
1,136 lines
/*
Before trying to compile and run this program, read and follow Part II of
Turbo ScrEdit Tutor (stored in the file ScrEdit.Tut.)
*/
#include <alloc.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
#include <process.h>
#include <errno.h>
#include "scredit.h"
/*
Remember to use Turbo ScrEdit to compile the screens in ScrDemo.Scr before you
try to compile and run this program. See Turbo ScrEdit Tutor for instructions.
*/
#include "SCRDEMO.001"
#include "SCRDEMO.002"
#include "SCRDEMO.003"
#include "SCRDEMO.004"
#include "SCRDEMO.005"
int Result,
Tr,Tc,Br,Bc,
Option,
Screen_Mode,
Cursor_Position;
char Name[35],
Address_a[35],
Address_b[35],
City[21],
State[3],
ZipCode[10],
Phone[15],
Ssn[12];
double Gross;
/*****************************
MENU OPTION 1 (Example data entry screen)
Section 2 of Turbo ScrEdit Tutor Describes this portion of code
*****************************/
void RecordDemo_Init()
{
Initialize_Dupe_Fields_buf();
Initialize_Mouse_Demo_buf();
Name[0]=0;
Address_a[0]=0;
Address_b[0]=0;
City[0]=0;
State[0]=0;
ZipCode[0]=0;
Phone[0]=0;
Ssn[0]=0;
Gross=0;
S_Msg[0] = 0;
S_Point = -1;
S_EnterAsTab = 0;
S_LoadScreen("Dupe_Fields");
S_ClearScreen(1);
}
char *MakeMsg(int mode, int Bg, int Fg)
{
char colorwork[3],workstr[85];
switch (mode)
{
case 1 :
{
strcpy(workstr," Change colors of ERROR messages from VALIDATE procedures Bg(");
break;
}
case 2 :
{
strcpy(workstr," Change Colors of HELP messages accessed by auto help or '?' Bg(");
break;
}
case 3 :
{
strcpy(workstr," Specify the color attributes for you customer messages Bg (");
break;
}
}
itoa(Bg,colorwork,10);
strcat(workstr,colorwork);
strcat(workstr,") Fg(");
itoa(Fg,colorwork,10);
strcat(workstr,colorwork);
strcat(workstr,")");
workstr[79]=0;
return (char *)&workstr;
}
void EnterRecords()
{
if (S_EnterAsTab)
strcpy(Dupe_Fields_buf.Key," F10 ");
else
strcpy(Dupe_Fields_buf.Key,"Enter");
S_ReadScreen();
if ((S_Ctrl)&&((S_Ch=='A')||(S_Ch=='a')))
{
switch (S_Cursor)
{
case S_OFF
: {S_Cursor=S_BOLD;break;}
case S_BOLD
: {S_Cursor=S_NORMAL;break;}
case S_NORMAL
: {S_Cursor=S_INVERSENORMAL;break;}
case S_INVERSENORMAL
: {S_Cursor=S_INVERSEBOLD;break;}
default :
S_Cursor=S_OFF;
}
}
while ((S_Home)||(S_End)||(S_Up)||(S_Down)||(S_PgUp)||(S_PgDn))
{
if ((S_Home)||(S_End))
strcpy(S_ErrorMsg,MakeMsg(1,(int)S_ErrorBg,(int)S_ErrorFg));
if ((S_Up)||(S_Down))
strcpy(S_AutoHelpMsg,MakeMsg(2,(int)S_HelpBg,(int)S_HelpFg));
if ((S_PgUp)||(S_PgDn))
strcpy(S_UserMsg,MakeMsg(3,(int)S_UserBg,(int)S_UserFg));
S_ReadKey();
if ((S_Home)||(S_End))
{
if (S_Home) S_ErrorBg++;
if (S_End) S_ErrorFg++;
if (S_ErrorBg > 7) S_ErrorBg = 0;
if (S_ErrorFg > 15) S_ErrorFg = 0;
}
if ((S_Up)||(S_Down))
{
if (S_Up) S_HelpBg++;
if (S_Down) S_HelpFg++;
if (S_HelpBg > 7) S_HelpBg = 0;
if (S_HelpFg > 15) S_HelpFg = 0;
}
if ((S_PgUp)||(S_PgDn))
{
if (S_PgUp) S_UserBg++;
if (S_PgDn) S_UserFg++;
if (S_UserBg > 7) S_UserBg = 0;
if (S_UserFg > 15) S_UserFg = 0;
}
}
if (S_F1)
{
if (!S_IsDupe(S_PrevField))
{
S_SetDupe(S_PrevField-1);
S_SetDupe(S_PrevField+1);
S_SetDupe(S_PrevField);
if (S_IsDupe(S_PrevField))
switch (S_PrevField)
{
case 11 : {strcpy(Dupe_Fields_buf.a,"[");
strcpy(Dupe_Fields_buf.r,"]");break;}
case 14 : {strcpy(Dupe_Fields_buf.b,"[");
strcpy(Dupe_Fields_buf.s,"]");break;}
case 17 : {strcpy(Dupe_Fields_buf.c,"[");
strcpy(Dupe_Fields_buf.t,"]");break;}
case 20 : {strcpy(Dupe_Fields_buf.d,"[");
strcpy(Dupe_Fields_buf.u,"]");break;}
case 23 : {strcpy(Dupe_Fields_buf.e,"[");
strcpy(Dupe_Fields_buf.v,"]");break;}
case 26 : {strcpy(Dupe_Fields_buf.f,"[");
strcpy(Dupe_Fields_buf.w,"]");break;}
case 29 : {strcpy(Dupe_Fields_buf.g,"[");
strcpy(Dupe_Fields_buf.x,"]");break;}
case 32 : {strcpy(Dupe_Fields_buf.h,"[");
strcpy(Dupe_Fields_buf.y,"]");break;}
case 35 : {strcpy(Dupe_Fields_buf.i,"[");
strcpy(Dupe_Fields_buf.z,"]");break;}
}
}
else
{
S_ReSetDupe(S_PrevField-1);
S_ReSetDupe(S_PrevField+1);
S_ReSetDupe(S_PrevField);
if (!S_IsDupe(S_PrevField))
switch (S_PrevField)
{
case 11 : {Dupe_Fields_buf.a[0]=0;Dupe_Fields_buf.r[0]=0;break;}
case 14 : {Dupe_Fields_buf.b[0]=0;Dupe_Fields_buf.s[0]=0;break;}
case 17 : {Dupe_Fields_buf.c[0]=0;Dupe_Fields_buf.t[0]=0;break;}
case 20 : {Dupe_Fields_buf.d[0]=0;Dupe_Fields_buf.u[0]=0;break;}
case 23 : {Dupe_Fields_buf.e[0]=0;Dupe_Fields_buf.v[0]=0;break;}
case 26 : {Dupe_Fields_buf.f[0]=0;Dupe_Fields_buf.w[0]=0;break;}
case 29 : {Dupe_Fields_buf.g[0]=0;Dupe_Fields_buf.x[0]=0;break;}
case 32 : {Dupe_Fields_buf.h[0]=0;Dupe_Fields_buf.y[0]=0;break;}
case 35 : {Dupe_Fields_buf.i[0]=0;Dupe_Fields_buf.z[0]=0;break;}
}
}
}
if (S_F2)
{
S_ClearDupes();
setmem(Dupe_Fields_buf.a,2,0);
setmem(Dupe_Fields_buf.b,2,0);
setmem(Dupe_Fields_buf.c,2,0);
setmem(Dupe_Fields_buf.d,2,0);
setmem(Dupe_Fields_buf.e,2,0);
setmem(Dupe_Fields_buf.f,2,0);
setmem(Dupe_Fields_buf.g,2,0);
setmem(Dupe_Fields_buf.h,2,0);
setmem(Dupe_Fields_buf.i,2,0);
setmem(Dupe_Fields_buf.r,2,0);
setmem(Dupe_Fields_buf.s,2,0);
setmem(Dupe_Fields_buf.t,2,0);
setmem(Dupe_Fields_buf.u,2,0);
setmem(Dupe_Fields_buf.v,2,0);
setmem(Dupe_Fields_buf.w,2,0);
setmem(Dupe_Fields_buf.x,2,0);
setmem(Dupe_Fields_buf.y,2,0);
setmem(Dupe_Fields_buf.z,2,0);
}
if (S_F3)
{
if (S_HelpSound==1)
{
S_HelpSound =0;
S_ErrorSound=0;
S_UserSound =0;
}
else
{
S_HelpSound =1;
S_ErrorSound=1;
S_UserSound =1;
}
}
if (S_F4)
S_AutoHelp = (S_AutoHelp==1)? 0:1;
if (S_F5)
S_AutoValidate = (S_AutoValidate==1)? 0:1;
if (S_F6)
if (Dupe_Fields_buf.Name1[0]>0)
{
strcpy(Dupe_Fields_buf.Name2,Dupe_Fields_buf.Name1);
strcpy(Dupe_Fields_buf.Address2_a,Dupe_Fields_buf.Address1_a);
strcpy(Dupe_Fields_buf.Address2_b,Dupe_Fields_buf.Address1_b);
strcpy(Dupe_Fields_buf.City2,Dupe_Fields_buf.City1);
strcpy(Dupe_Fields_buf.S2,Dupe_Fields_buf.S1);
strcpy(Dupe_Fields_buf.Zip2,Dupe_Fields_buf.Zip1);
strcpy(Dupe_Fields_buf.Phone2,Dupe_Fields_buf.Phone1);
strcpy(Dupe_Fields_buf.Ssn2,Dupe_Fields_buf.Ssn1);
Dupe_Fields_buf.Gross2=Dupe_Fields_buf.Gross1;
setmem(Dupe_Fields_buf.Name1,35,0);
setmem(Dupe_Fields_buf.Address1_a,35,0);
setmem(Dupe_Fields_buf.Address1_b,35,0);
setmem(Dupe_Fields_buf.City1,21,0);
setmem(Dupe_Fields_buf.S1,3,0);
setmem(Dupe_Fields_buf.Zip1,10,0);
setmem(Dupe_Fields_buf.Phone1,15,0);
setmem(Dupe_Fields_buf.Ssn1,12,0);
Dupe_Fields_buf.Gross1 = 0;
S_Point = 8;
}
else
strcpy(S_UserMsg," No record entered to Edit..");
if (S_F9)
S_EnterAsTab = (S_EnterAsTab) ? 0:1;
if ((S_EnterAsTab)&&(S_F10))
{
S_ScreenValid = 1;
S_ValidateScreen();
if (!S_ScreenValid) S_ResetKeyFlags();
}
if (((!S_EnterAsTab)&&(S_Enter))||((S_EnterAsTab)&&(S_F10)))
{
strcpy(Name,Dupe_Fields_buf.Name2);
strcpy(Address_a,Dupe_Fields_buf.Address2_a);
strcpy(Address_b,Dupe_Fields_buf.Address2_b);
strcpy(City,Dupe_Fields_buf.City2);
strcpy(State,Dupe_Fields_buf.S2);
strcpy(ZipCode,Dupe_Fields_buf.Zip2);
strcpy(Phone,Dupe_Fields_buf.Phone2);
strcpy(Ssn,Dupe_Fields_buf.Ssn2);
Gross=Dupe_Fields_buf.Gross2;
S_ClearScreen(1);
strcpy(Dupe_Fields_buf.Name1,Name);
strcpy(Dupe_Fields_buf.Address1_a,Address_a);
strcpy(Dupe_Fields_buf.Address1_b,Address_b);
strcpy(Dupe_Fields_buf.City1,City);
strcpy(Dupe_Fields_buf.S1,State);
strcpy(Dupe_Fields_buf.Zip1,ZipCode);
strcpy(Dupe_Fields_buf.Phone1,Phone);
strcpy(Dupe_Fields_buf.Ssn1,Ssn);
Dupe_Fields_buf.Gross1=Gross;
S_Point = 8;
}
}
void RecordDemo()
{
RecordDemo_Init();
while (!S_Esc)
{
EnterRecords();
}
S_EnterAsTab = 0;
S_AutoHelp = 0;
S_ErrorSound = 1;
S_HelpSound = 1;
S_UserSound = 1;
S_SetDisplayOff(1);
S_ClearDupes();
setmem(Dupe_Fields_buf.v,2,0);
setmem(Dupe_Fields_buf.w,2,0);
setmem(Dupe_Fields_buf.x,2,0);
setmem(Dupe_Fields_buf.y,2,0);
setmem(Dupe_Fields_buf.z,2,0);
setmem(Dupe_Fields_buf.a,2,0);
}
/*****************************
MENU OPTION 2 (Demo of Mouse functions)
Section 3 of Turbo ScrEdit Tutor Describes this portion of code
*****************************/
void Set_Button_Labels()
{
if (S_MsLeftPressed) strcpy(Mouse_Demo_buf.Lb,"*Pressed*");
else if (S_MsLeftReleased) strcpy(Mouse_Demo_buf.Lb,"*Released*");
else Mouse_Demo_buf.Lb[0]=0;
if (S_MsMiddlePressed) strcpy(Mouse_Demo_buf.Mb,"*Pressed*");
else if (S_MsMiddleReleased) strcpy(Mouse_Demo_buf.Mb,"*Released*");
else Mouse_Demo_buf.Mb[0]=0;
if (S_MsRightPressed) strcpy(Mouse_Demo_buf.Rb,"*Pressed*");
else if (S_MsRightReleased) strcpy(Mouse_Demo_buf.Rb,"*Released*");
else Mouse_Demo_buf.Rb[0]=0;
}
void Set_Event_Mask()
{
if ((S_MsLeftPressed)&&(S_MsRow==2)&&((S_MsCol>2)&&(S_MsCol<19)))
{
if (Mouse_Demo_buf.EM[0]=='1')
{
Mouse_Demo_buf.EM[0]='0';
S_ChangeFieldColor(0,2,0,7);
}
else
{
Mouse_Demo_buf.EM[0]='1';
S_ChangeFieldColor(0,2,7,0);
}
}
if ((S_MsLeftPressed)&&(S_MsRow==2)&&((S_MsCol>20)&&(S_MsCol<40)))
{
strcpy(S_ErrorMsg,"The Left Mouse Button must remain enabled for this demo..");
}
if ((S_MsLeftPressed)&&(S_MsRow==3)&&((S_MsCol>20)&&(S_MsCol<40)))
{
if (Mouse_Demo_buf.EM[2]=='1')
{
Mouse_Demo_buf.EM[2]='0';
S_ChangeFieldColor(5,2,0,7);
}
else
{
Mouse_Demo_buf.EM[2]='1';
S_ChangeFieldColor(5,2,7,0);
}
}
if ((S_MsLeftPressed)&&(S_MsRow==2)&&((S_MsCol>59)&&(S_MsCol<80)))
{
if (Mouse_Demo_buf.EM[3]=='1')
{
Mouse_Demo_buf.EM[3]='0';
S_ChangeFieldColor(3,2,0,7);
}
else
{
Mouse_Demo_buf.EM[3]='1';
S_ChangeFieldColor(3,2,7,0);
}
}
if ((S_MsLeftPressed)&&(S_MsRow==3)&&((S_MsCol>59)&&(S_MsCol<80)))
{
if (Mouse_Demo_buf.EM[4]=='1')
{
Mouse_Demo_buf.EM[4]='0';
S_ChangeFieldColor(7,2,0,7);
}
else
{
Mouse_Demo_buf.EM[4]='1';
S_ChangeFieldColor(7,2,7,0);
}
}
if ((S_MsLeftPressed)&&(S_MsRow==2)&&((S_MsCol>40)&&(S_MsCol<59)))
{
if (Mouse_Demo_buf.EM[5]=='1')
{
Mouse_Demo_buf.EM[5]='0';
S_ChangeFieldColor(2,2,0,7);
}
else
{
Mouse_Demo_buf.EM[5]='1';
S_ChangeFieldColor(2,2,7,0);
}
}
if ((S_MsLeftPressed)&&(S_MsRow==3)&&((S_MsCol>40)&&(S_MsCol<59)))
{
if (Mouse_Demo_buf.EM[6]=='1')
{
Mouse_Demo_buf.EM[6]='0';
S_ChangeFieldColor(6,2,0,7);
}
else
{
Mouse_Demo_buf.EM[6]='1';
S_ChangeFieldColor(6,2,7,0);
}
}
}
void Change_Mode()
{
if ((S_MsLeftPressed)&&(S_MsRow==7)&&((S_MsCol>1)&&(S_MsCol<5)))
{
Tr=6;
Tc=30;
Br=17;
Bc=52;
S_SetMouseRange(Tc,Tr,Bc,Br);
S_MsRow = 11;
S_MsCol = 41;
S_MoveMouse();
}
if ((S_MsLeftPressed)&&(S_MsRow==9)&&((S_MsCol>1)&&(S_MsCol<5)))
{
Tr=6;
Tc=58;
Br=17;
Bc=79;
S_SetMouseRange(Tc,Tr,Bc,Br);
S_MsRow = 11;
S_MsCol = 68;
S_MoveMouse();
}
if ((S_MsLeftPressed)&&(S_MsRow==5)&&((S_MsCol>1)&&(S_MsCol<5)))
{
S_ChangeFieldColor(4,2,2,0);
strcpy(Mouse_Demo_buf.End_Set_Up,"** FINISHED **");
Tr=2;
Tc=3;
Br=3;
Bc=79;
S_SetMouseRange(Tc,Tr,Bc,Br);
S_MsRow = 3;
S_MsCol = 8;
S_MoveMouse();
}
}
void MouseDemo()
{
S_ActivateMouse();
S_SetMouseEvent(Mouse_Demo_buf.EM);
Tr=5;
Tc=1;
Br=18;
Bc=29;
S_SetMouseRange(Tc,Tr,Bc,Br);
S_MsRow = 5;
S_MsCol = 1;
S_ShowMouse();
do
{
Mouse_Demo_buf.Cr=(double)S_MsRow;
Mouse_Demo_buf.Cc=(double)S_MsCol;
Mouse_Demo_buf.Ur=(double)Tr;
Mouse_Demo_buf.Uc=(double)Tc;
Mouse_Demo_buf.Lr=(double)Br;
Mouse_Demo_buf.Lc=(double)Bc;
S_ResetMouseFlags();
S_ReadKey();
if (S_Ms->MouseEvent)
S_AnalizeMouse();
Set_Button_Labels();
if (((S_MsLeftPressed)&&(S_MsRow==11)&&((S_MsCol>35)&&(S_MsCol<48)))||
((S_MsLeftPressed)&&(S_MsRow==11)&&((S_MsCol>62)&&(S_MsCol<75)))||
((S_MsLeftPressed)&&(S_MsRow==3) &&((S_MsCol>2) &&(S_MsCol<17))))
{
S_SetMouseRange(1,5,28,18);
if (S_MsRow==3)
{
S_ChangeFieldColor(4,2,0,4);
Mouse_Demo_buf.End_Set_Up[0]=0;
S_SetMouseEvent(Mouse_Demo_buf.EM);
S_MsRow = 5;
S_MsCol = 3;
S_MoveMouse();
}
else
if (S_MsCol > 62)
{
S_MsRow=9;
S_MsCol=3;
S_MoveMouse();
}
else
{
S_MsRow=7;
S_MsCol=3;
S_MoveMouse();
}
}
else
{
switch (S_MsRow)
{
case 2:
case 3: {Set_Event_Mask();break;}
case 5:
case 7:
case 9: {Change_Mode();break;}
}
}
}
while (!((S_MsLeftPressed)&&(S_MsRow==11)&&((S_MsCol>1)&&(S_MsCol<5))));
S_ResetMouseFlags();
S_HideMouse();
S_DisableMouse();
}
/*****************************
MENU OPTION 3 (Customizing Screen Colors)
Section 4 of Turbo ScrEdit Tutor Describes this portion of code
*****************************/
void ChangeColors()
{
int X,Y;
Color_Demo_buf.F1=2.0;
Color_Demo_buf.A =0.0;
Color_Demo_buf.F2=0.0;
Color_Demo_buf.B =5.0;
Color_Demo_buf.F3=15.0;
Color_Demo_buf.C =0.0;
Color_Demo_buf.F4=14.0;
Color_Demo_buf.D =0.0;
Color_Demo_buf.F5=3.0;
Color_Demo_buf.E =0;
Color_Demo_buf.F6=2.0;
Color_Demo_buf.F =0.0;
Color_Demo_buf.F7=2.0;
Color_Demo_buf.G =0.0;
Color_Demo_buf.F8=15.0;
Color_Demo_buf.H =0.0;
Color_Demo_buf.F9=2.0;
Color_Demo_buf.I =0.0;
while (!S_Esc)
{
S_ReadScreen();
/* Text */
S_ChangeScreenColor(
0,(int)Color_Demo_buf.A,(int)Color_Demo_buf.F1, 1,24, 1,80);
/* double line around logo */
S_ChangeScreenColor(
2,(int)Color_Demo_buf.D,(int)Color_Demo_buf.F4, 1,11, 1,80);
/* Logo */
S_ChangeScreenColor(
2,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 9,10,69);
/* Fill in logo letters */
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 8,11,11);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 8,18,18);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 5, 8,22,22);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 5, 8,27,27);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 5, 8,31,31);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 7, 8,35,35);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 5, 6,36,36);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 8,40,40);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 3, 3,47,47);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 8, 8,47,47);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 5, 8,51,51);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 8,56,56);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 6, 8,60,60);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 8,64,64);
/* other logo text */
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 6, 6, 3, 7);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 2, 2,21,24);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 5, 5,67,78);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 6, 6,69,76);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 7, 7,70,74);
S_ChangeScreenColor(
0,(int)Color_Demo_buf.B,(int)Color_Demo_buf.F2, 8, 9,67,79);
/* Copyright Notice */
S_ChangeScreenColor(
0,(int)Color_Demo_buf.C,(int)Color_Demo_buf.F3,10,10,27,57);
/* Version Number */
S_ChangeScreenColor(
0,(int)Color_Demo_buf.E,(int)Color_Demo_buf.F5, 3, 3,71,75);
/* text in configure box */
S_ChangeScreenColor(
0,(int)Color_Demo_buf.G,(int)Color_Demo_buf.F7,13,23,18,64);
/* single line box */
S_ChangeScreenColor(
1,(int)Color_Demo_buf.F,(int)Color_Demo_buf.F6,13,24,17,65);
X = 0;
while (X < 18)
{
S_ChangeFieldColor(
X,1,(int)Color_Demo_buf.H,(int)Color_Demo_buf.F8);
S_ChangeFieldColor(
X,2,(int)Color_Demo_buf.I,(int)Color_Demo_buf.F9);
X++;
}
S_RefreshScreen();
}
}
/*****************************
MENU OPTION 9 (Mixed ScrEdit)
Section 4 of Turbo ScrEdit Tutor Describes this portion of code
*****************************/
void Back_To_Turbo_C_Land()
{
char Response[11];
Response[0] = 0;
textbackground(BLACK);
textcolor (YELLOW);
while (strcmp("RETURN",Response)!= 0)
{
clrscr();
cprintf("This is regular 'C' code now.\r\n\r\n");
cprintf("You can do anything now that you want to, use any \r\n");
cprintf("programming statement that you wish to. When you \r\n");
cprintf("are ready to resume with Turbo ScrEdit just return \r\n");
cprintf("and the screen will be reloaded and you will resume \r\n");
cprintf("at the point where you left the screen.\r\n\r\n");
cprintf("Type 'RETURN' in upper case to end this example...");
Response[0]=6;
cscanf("%s",Response);
}
textbackground(BLACK);
textcolor (GREEN);
}
/*****************************
START OF MAIN MENU SCREEN PROCEDURES
Section 1 of Turbo ScrEdit Tutor Describes this portion of code
*****************************/
void ProcessScreen()
{
S_ShowStatus = 1;
if (Screen_Mode==1)
{
Cursor_Position = atoi(Demo_Screen_buf.op);
switch (Cursor_Position){
case 0 : {S_Point = S_FirstField;break;}
case 1 : {S_Point = 1 ;break;}
case 2 : {S_Point = 4 ;break;}
case 3 : {S_Point = 11;break;}
case 4 : {S_Point = 8 ;break;}
}
}
if (Screen_Mode == 2)
{
Cursor_Position = atoi(Demo_Screen_buf.op);
S_Point ++;
switch (Cursor_Position){
case 0 :{S_Point = 0;
break;
}
case 1 :{if ((S_Point > 3)|| (S_Point < 1)) S_Point = 1;
break;
}
case 2 :{if ((S_Point > 9)||(S_Point < 4)) S_Point = 4;
if (S_Point == 8) S_Point = 9;
break;
}
case 3 :{if ((S_Point > 12)||(S_Point < 11)) S_Point = 11;
break;
}
case 4 :{if ((S_Point > 10)||(S_Point < 8)) S_Point = 8;
if (S_Point == 9) S_Point = 10;
break;
}
}
}
strcpy(S_UserMsg," <F1>=Initialize <F2>=Return to Menu ");
switch (Screen_Mode){
case 2 : {S_ReadField() ;break;}
case 1 : {S_ReadScreen() ;break;}
}
if (S_Fkey)
{
if ((!S_Shift)&&(!S_Ctrl)&&(!S_Alt))
{
if (S_F1)
{
Initialize_Demo_Screen_buf();
S_Point = S_FirstField;
strcpy(S_UserMsg,"Screen has been initialized.");
}
if (S_F2)
S_LoadScreen("Demo_Menu");
}
}
}
void ScrDemo_Init()
{
S_OpenScreenFile("ScrDemo.SCR");
Initialize_Demo_Menu_buf();
Initialize_Demo_Screen_buf();
Initialize_Mouse_Demo_buf();
Option = 1;
S_Sound = 1;
S_ErrorSound = 1;
S_ErrorFreq = 300;
S_ErrorDur = 100;
S_HelpSound = 1;
S_HelpFreq = 400;
S_HelpDur = 100;
S_UserSound = 1;
S_UserFreq = 200;
S_UserDur = 100;
S_ShowStatus = 1;
S_Cursor = S_NORMAL;/* other options S_BLOCK, S_OFF */
textbackground(BLACK);
textcolor (GREEN);
}
void Read_Menu_Screen()
{
int X,Y,Z;
Option = 1;
S_LoadScreen("Demo_Menu");
do
{
strcpy(Demo_Menu_buf.O1, "Example Data Entry Screen");
strcpy(Demo_Menu_buf.O2, "Demo of Mouse functions");
strcpy(Demo_Menu_buf.O3, "Customizing screen colors.");
strcpy(Demo_Menu_buf.O4, "Using S_ReadScreen");
strcpy(Demo_Menu_buf.O5, "Using S_ReadField");
strcpy(Demo_Menu_buf.O6, "Using S_ReadKey");
strcpy(Demo_Menu_buf.O7, "Using S_NextKey");
strcpy(Demo_Menu_buf.O8, "'Pop Up' windows demo");
strcpy(Demo_Menu_buf.O13,"Mixed ScrEdit");
if (Option < 1) Option = 9;
if (Option > 9) Option = 1;
Demo_Menu_buf.P1[0] = 0;
Demo_Menu_buf.P2[0] = 0;
Demo_Menu_buf.P3[0] = 0;
Demo_Menu_buf.P4[0] = 0;
Demo_Menu_buf.P5[0] = 0;
Demo_Menu_buf.P6[0] = 0;
Demo_Menu_buf.P7[0] = 0;
Demo_Menu_buf.P8[0] = 0;
Demo_Menu_buf.P13[0] = 0;
switch (Option)
{
case 1 : {
strcpy(Demo_Menu_buf.M1,"This option is a pratical example of a");
strcpy(Demo_Menu_buf.M2,"data entry screen that demonstrates how");
strcpy(Demo_Menu_buf.M3,"to use EDIT MASKS, DUPE FIELDS, AUTO");
strcpy(Demo_Menu_buf.M4,"HELP, AUTO VALIDATE, SOUND ON/OFF,");
strcpy(Demo_Menu_buf.M5,"CLEAR SCREEN, CLEAR DUPES, and CHANGING");
strcpy(Demo_Menu_buf.M6,"MESSAGE LINE COLORS.");
strcpy(Demo_Menu_buf.P1,"==>");
break;
}
case 2 : {
strcpy(Demo_Menu_buf.M1,"Using the MOUSE interface. This option ");
strcpy(Demo_Menu_buf.M2,"shows how to set up and use all the ");
strcpy(Demo_Menu_buf.M3,"features of the MOUSE and MOUSE DRIVER.");
strcpy(Demo_Menu_buf.M4,"How to monitor for mouse buttons being");
strcpy(Demo_Menu_buf.M5,"pressed or mouse movement. How to");
strcpy(Demo_Menu_buf.M6,"define mouse windows, and much more..");
strcpy(Demo_Menu_buf.P2,"==>");
break;
}
case 3 : {
strcpy(Demo_Menu_buf.M1,"This option demonstrates how to change");
strcpy(Demo_Menu_buf.M2,"the color assignments for screens, and");
strcpy(Demo_Menu_buf.M3,"screen fields 'on the fly.' With these");
strcpy(Demo_Menu_buf.M4,"procedures you can write routines that");
strcpy(Demo_Menu_buf.M5,"will make your applications custom-");
strcpy(Demo_Menu_buf.M6,"zable to the users taste. ");
strcpy(Demo_Menu_buf.P3,"==>");
break;
}
case 4 : {
strcpy(Demo_Menu_buf.M1,"This option will demonstrate using more");
strcpy(Demo_Menu_buf.M2,"complex field validation statements to ");
strcpy(Demo_Menu_buf.M3,"control data entry into a screen. It ");
strcpy(Demo_Menu_buf.M4,"demonstartes the user of nearly all the");
strcpy(Demo_Menu_buf.M5,"field validation statements using with ");
strcpy(Demo_Menu_buf.M6,"S_READSCREEN.");
strcpy(Demo_Menu_buf.P4,"==>");
break;
}
case 5 : {
strcpy(Demo_Menu_buf.M1,"This option is just like option 4 ");
strcpy(Demo_Menu_buf.M2,"except it uses S_READFIELD to processes");
strcpy(Demo_Menu_buf.M3,"each field on the screen individualy.");
strcpy(Demo_Menu_buf.M4,"You will see that it works quite diff-");
strcpy(Demo_Menu_buf.M5,"erently than the previous example that");
strcpy(Demo_Menu_buf.M6,"used S_READSCREEN.");
strcpy(Demo_Menu_buf.P5,"==>");
break;
}
case 6 : {
strcpy(Demo_Menu_buf.M1,"This option demonstates how a program");
strcpy(Demo_Menu_buf.M2,"can communicate with the user using the");
strcpy(Demo_Menu_buf.M3,"message line to display a messsage and");
strcpy(Demo_Menu_buf.M4,"wait for the user to respond by pressing");
strcpy(Demo_Menu_buf.M5,"a key. The key pressed is not echoed to");
strcpy(Demo_Menu_buf.M6,"the screen. See S_READKEY for more info");
strcpy(Demo_Menu_buf.P6,"==>");
break;
}
case 7 : {
strcpy(Demo_Menu_buf.M1,"This option demonstrates how S_NEXTKEY");
strcpy(Demo_Menu_buf.M2,"works. It is similar to S_READKEY");
strcpy(Demo_Menu_buf.M3,"except no message or screen fields are ");
strcpy(Demo_Menu_buf.M4,"displayed. Only the next key pressed is");
strcpy(Demo_Menu_buf.M5,"returned to your program.");
strcpy(Demo_Menu_buf.P7,"==>");
break;
}
case 8 : {
strcpy(Demo_Menu_buf.M1,"Demonstrates iHn System's 'POP UP'");
strcpy(Demo_Menu_buf.M2,"windows package that is included with");
strcpy(Demo_Menu_buf.M3,"the registered version of Turbo ScrEdit");
strcpy(Demo_Menu_buf.M4,"");
strcpy(Demo_Menu_buf.M5,"");
strcpy(Demo_Menu_buf.M6,"");
strcpy(Demo_Menu_buf.P8,"==>");
break;
}
case 9 : {
strcpy(Demo_Menu_buf.M1,"This demonstrates how you can exit a");
strcpy(Demo_Menu_buf.M2,"procedure using a Turbo ScrEdit screen");
strcpy(Demo_Menu_buf.M3,"to use your language's standard screen");
strcpy(Demo_Menu_buf.M4,"I/O statements such as clrscr, cprint,");
strcpy(Demo_Menu_buf.M5,"scanf, ect. To resume right were you");
strcpy(Demo_Menu_buf.M6,"left off us S_REFRESHSCREEN and go on.");
strcpy(Demo_Menu_buf.P13,"==>");
}
}
S_ResetKeyFlags();
while ((!S_Esc)&&(!S_Enter)&&(!S_Fkey))
{
S_ReadKey();
if ((S_Up)||(S_Down)||(S_Enter)||(S_Esc))
{
if (S_Down) Option++;
if (S_Up) Option--;
if (S_Enter)
{
if (Option==1)
{
RecordDemo();
S_LoadScreen("Demo_Menu");
}
if (Option == 2)
{
if (S_MouseInstalled)
{
S_LoadScreen("Mouse_Demo");
S_ClearScreen(1);
MouseDemo();
S_LoadScreen("Demo_Menu");
}
else
strcpy(S_ErrorMsg," Mouse driver is not loaded into memory ");
}
if (Option == 3)
{
Initialize_Color_Demo_buf();
S_LoadScreen("Color_Demo");
ChangeColors();
S_LoadScreen("Demo_Menu");
}
if (Option == 4)
{
Screen_Mode = 1;
Initialize_Demo_Screen_buf();
S_LoadScreen("Demo_Screen");
while (!S_F2) ProcessScreen();
}
if (Option == 5)
{
Screen_Mode = 2;
Initialize_Demo_Screen_buf();
S_LoadScreen("Demo_Screen");
while (!S_F2) ProcessScreen();
}
if (Option == 6)
{
strcpy(S_UserMsg,
"Demo of S_READKEY - Press 'C' key to continue");
do{
S_ReadKey();
strcpy(S_UserMsg,
"OOPS!! wrong key - Press 'C' key to continue");
} while ((S_Ch!='C')&&(S_Ch!='c'));
strcpy(S_UserMsg," 'C' has been pressed - You may continue");
}
if (Option == 7)
{
for (X=1;X<7;X++){
gotoxy(39,14+X);
cprintf(" ");}
gotoxy(39,17);
cprintf(" << OKAY PRESS A SHIFT C to CONTINUE >>");
do{
S_NextKey();
S_Ch = toupper(S_Ch);
} while (!((S_Shift)&&(S_Ch=='C')));
}
if (Option == 8)
{
Result = spawnl(P_WAIT,"DemoWind.exe","0",NULL);
if (Result == -1)
{
switch (errno)
{
case ENOENT:
{
strcpy(S_UserMsg," 'DemoWind.Exe' not found! ");
break;
}
case ENOMEM:
{
strcpy(S_UserMsg," Not enough memeory to run windows demo. ");
break;
}
}
}
else
strcpy(S_UserMsg," End of Windows Demo ");
}
if (Option == 9)
{
Back_To_Turbo_C_Land();
S_RefreshScreen();
}
S_ShowStatus = 1;
S_ResetKeyFlags();
}
}
else
strcpy(S_UserMsg," Only UP and DOWN arrows and ENTER and ESC are valid");
}
}
while (!S_Esc);
}
/*****************************
PROGRAM BEGINS HERE
*****************************/
void main()
{
ScrDemo_Init();
while (!S_Esc) Read_Menu_Screen();
S_CloseScreenFile();
gotoxy(1,24);
}